#ifndef BUZZER_H
#define BUZZER_H
/**
 * @defgroup nxbot_buzzer BUZZER Library
 * @ingroup nxbot_low_level 
 * @code #include <buzzer.h> @endcode
 * @brief Interrupt-driven buzzer library for implementing a sound device. 
 *
 * This module is used to generate musical notes with the robot NXBot. The frequencies for each note are produced using a time interrupt strategy.
 * That means, one of the timers of the microcontroller is used for timing purposes, in order to obtain non-blocking functions. Therefore, it is
 * necessary to enable interrupts, for example via the <i>sei()</i> function.
 */

/**@{*/
/**
   @brief   Definition of three note-scales.
*/
enum {
	SILENCE=255, DO1 = 0, RE1, MI1, FA1, SOL1, LA1, SI1, DO2, RE2, MI2, FA2, SOL2, LA2, SI2, DO3, RE3, MI3, FA3, SOL3, LA3, SI3
};
/**
 * @brief   Initialize the buzzer hardware.
 *
 * Enables the pin where the %buzzer will be connected. Configures timer 4 but it remains stopped.
 */
void buzzer_init(void);

/**
 * @brief   Enables the buzzer.
 *
 * The last configured note defined with buzzer_note() will be generated.
 */
void buzzer_enable(void);
/**
 * @brief   Disables the buzzer.
 *
 * The timer returns to stopped-state.
 */
void buzzer_disable(void);

/**
 * @brief   Specifies the note that should be generated.
 *
 * Generates one of the notes of the three configured scales.
 * @param note One of the notes previously defined, e.g RE1.
 */
void buzzer_note(unsigned char note);

/**
 * @brief   Disables the buzzer for a defined time. Not yet implemented.
 *
 * No sound will be generated until time is concluded.
 * WARNING!!! THIS FUNCTION IS NOT (YET) IMPLEMENTED. 
 */
void buzzer_silence(unsigned char time);

/**@}*/
#endif
